package org.xiaom.butler.util;

import org.xiaom.butler.R;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBHelper extends SQLiteOpenHelper{
	public static final int FIRST_VERSION=1;
	public static final String DB_NAME="BUTLER_DB.db";
	private  Context context;
	public DBHelper(Context context) {
		super(context, DB_NAME, null, FIRST_VERSION);
		this.context=context;
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String[] ss=this.context.getResources().getStringArray(R.array.init_db_arrays);
		for(int i=0;i<ss.length;i++){
			db.execSQL(ss[i]);
		}
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		onCreate(db);
	}
	
}
